Polarized Subtyping for Sized Types

نویسنده

  • Andreas Abel
چکیده

ion. LEQ-λ Γ, X :pκ ` F ≤ F ′ : κ′ Γ ` λXF ≤ λXF ′ : pκ→ κ′ Application. There are two kinds of congruence rules for application: one kind states that if functions F and F ′ are in the subtyping relation, so are their values F G and F ′G at a certain argument G. LEQ-FUN Γ ` F ≤ F ′ : pκ→ κ′ p−1Γ ` G : κ Γ ` F G ≤ F ′G : κ′ The other kind of rules concern the opposite case: If F is a function and two arguments G and G′ are in a subtyping relation, so are the values F G and F G′ of the function at these arguments. However, such a relation can only exist if F is covariant or contravariant. LEQ-ARG+ Γ ` F : +κ→ κ′ Γ ` G ≤ G′ : κ Γ ` F G ≤ F G′ : κ′ LEQ-ARG− Γ ` F : −κ→ κ ′ −Γ ` G′ ≤ G : κ Γ ` F G ≤ F G′ : κ′ Note that we only included a subsumption rule for equality (EQ-SUB), not for subtyping. Subsumption for subtyping is admissible, as item 2 of the following lemma states: Lemma 2.7 (Admissible rules for equality and subtyping I). LetR ∈ {=,≤}. 1 Validity: If D :: Γ ` F R F ′ : κ then Γ ` F : κ and Γ ` F ′ : κ. 2 Weakening: If D :: Γ ` F R F ′ : κ and both Γ′ ≤ Γ and κ ≤ κ′, then Γ′ ` F R F ′ : κ′. 3 Strengthening: If D :: Γ, X :pκ ` F R F ′ : κ′ and X 6∈ FV(F, F ′), then Γ ` F R F ′ : κ′. Proof. Each by induction on D. Lemma 2.8 (Admissible rules for equality and subtyping II). See Fig. 2. 3. Algorithmic Polarized Subtyping In this section, we present an algorithm for deciding whether two well-kinded constructors are equal or related by subtyping. The algorithm is an adaption of Coquand’s βη-equality test (Coquand, 1991) to the needs of subtyping and polarities. The idea is to first weak-head normalize Polarized Subtyping 9 EQ-REFL Γ ` F : κ Γ ` F = F : κ LEQ-APP◦ Γ ` F ≤ F ′ : ◦κ→ κ′ ◦−1Γ ` G = G′ : κ Γ ` F G ≤ F ′G′ : κ′ LEQ-APP+ Γ ` F ≤ F ′ : +κ→ κ′ Γ ` G ≤ G′ : κ Γ ` F G ≤ F ′G′ : κ′ LEQ-APP− Γ ` F ≤ F ′ : −κ→ κ′ −Γ ` G′ ≤ G : κ Γ ` F G ≤ F ′G′ : κ′ LEQ-APP> Γ ` F ≤ F ′ : >κ→ κ′ >−1Γ ` G : κ >−1Γ ` G′ : κ Γ ` F G ≤ F ′G′ : κ′ EQ-APP-> Γ ` F = F ′ : >κ→ κ′ >−1Γ ` G : κ >−1Γ ` G′ : κ Γ ` F G = F ′G′ : κ′ Fig. 2. Admissible rules for equality and subtyping. the constructors under consideration and then compare their head symbols. If they are related, one continues to recursively compare the subcomponents, otherwise subtyping fails. Weak head normal forms W ∈ Val are given by the grammar: Ne 3 N ::= C | X | N G neutral constructors Val 3 V,W ::= N | λXF weak head values Weak head evaluation F ↘ W , a big-step call-by-name operational semantics, is defined inductively by the following rules: EVAL-C C ↘ C EVAL-VAR X ↘ X EVAL-LAM λXF ↘ λXF EVAL-APP-NE F ↘ N F G↘ N G EVAL-APP-β F ↘ λXF ′ [G/X]F ′ ↘W F G↘W Lemma 3.1 (Properties of weak head evaluation). 1 If F X ↘ W then either F ↘ λXF ′ and F ′ ↘ W , or F ↘ N and W = N X . If X 6∈ FV(F ) then X 6∈ FV(N). 2 If F ↘W and [G/X]W ↘ V then [G/X]F ↘ V . 3 If F ↘W andW G↘ V then F G↘ V . Lemma 3.2 (Soundness of weak head evaluation). If Γ ` F : κ and F ↘ W then Γ ` F = W : κ.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Polarized multispectral imaging in a rigid endoscope based on elastic light scattering spectroscopy

Elastic light scattering spectroscopy (LSS) is widely utilized to investigate cellular structures in cultured cells and various tissues. However, few imaging systems, especially endoscopic imaging systems, can implement LSS. It is the aim of this work to create a polarized multispectral imaging system based around a rigid endoscope to detect micrometer sized particles using LSS. The instrument ...

متن کامل

Subtyping Constrained Types ( Draft ) Valery Trifonov

Constrained type systems are a natural generalization of Hindley/Milner type inference to languages with subtyping. This paper develops several subtyping relations on constrained types. We establish a full type abstraction property that equates an operational notion of subtyping with a semantic notion based on regular trees. The decidability of this notion of subtyping is open; we present a dec...

متن کامل

Subtyping and Inheritance for Categorical

We extend Hagino's categorical datatypes with subtyping and a limited form of inheritance. The view of objects as coalgebras provides the inspiration for subtyping and inheritance for coalgebraic (or coinductive) types. Exploiting the duality between coalgebras and algebras then yields notions of subtyping and inheritance for algebraic (or inductive) types.

متن کامل

Concepts of Behavioral Subtyping and a Sketch of their Extension to Component-Based Systems

Object-oriented systems are able to treat objects indirectly by message passing. This allows them to manipulate objects without knowing their exact runtime type. Behavioral subtyping helps one reason in a modular fashion about such programs. That is, one can reason based on the static types of expressions in a program, provided that static types are upper bounds of the runtime types in a subtyp...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2006